#include "gtest/gtest.h"
#include "../BaseUtil/MyTest.h"
#include "MyVideoTrace.h"
namespace MyVideoTrace {

class VoodooLoaderTest : public testing::Test {
protected:
    virtual void SetUp() {
    	vd = new VoodooLoader();
    }
    virtual void TearDown() {
    	delete vd;
    }

    VoodooLoader * vd;
};

TEST_F(VoodooLoaderTest, LoadCameraFile) {
	ASSERT_TRUE( vd->loadCameraData("../VoodooData/car.txt") );
	ASSERT_EQ( 422ul, vd->getNumberOfCameraInfo() );
}

TEST_F(VoodooLoaderTest, LoadFeaturePoints) {
	ASSERT_TRUE( vd->loadFeaturePoints( "../VoodooData/car", 0, 10, ".pnt", 1) );
//	ASSERT_TRUE( vd->loadFeaturePoints( "../VoodooData/car", 0, 421, ".pnt", 1) );
	ASSERT_EQ( 47ul, vd->getNumberOfFeaturePoints() );

	// 533.063293457	84.0154724121	0	2	29.2066254888	-35.5303095799	106.683512624	1	1	533.123413086	82.2861175537	65
	FeaturePoint fpoint = vd->getFeaturePoint( 0 );
	ASSERT_EQ( 1, fpoint.getFeaturePointID() );
	ASSERT_TRUE( fpoint.endPoint2D() != fpoint.findPoint2D(3) );
	ASSERT_EQ( 533, fpoint.findPoint2D(3)->second.getX() );
}

}
